<script setup>
import {getArticleCate} from '@/api/article.js'
import {ref, defineProps, defineEmits} from 'vue'

defineProps({
  cateId: {
    type: [Number, String]
  },
  width: {
    type: String
  }
})
const emit = defineEmits(['update:modelValue'])
const list = ref([])
const getArticleList = async () => {
  const res = await getArticleCate()
  list.value = res.data.data
}
getArticleList()

</script>
<template>
  <!--label 展示给用户看的  value 收集起来提交给后台的-->
  <el-select :model-value="cateId" @update:modelValue="emit('update:modelValue',$event)" :style="{width}">
    <el-option v-for="item in list" :key="item.id" :label="item.cate_name" :value="item.id"></el-option>
  </el-select>
</template>
